Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to item creation #17

Merged
merged 7 commits into from
Oct 24, 2024
Merged

Conversation

Carifio24
Copy link
Member

This PR makes a few changes related to adding new students/educators/classes:

  • Expect 201 response codes (rather than 200) for successful student & educator registration
  • Update to use the newer /create endpoints (note that the old ones still work fine)
  • Update class creation (in both the frontend and the backend) to account for the class expected size added in Add expected size to class cds-api#151

A couple notes:

  • The expected size input field in the class creation dialog uses Solara's InputInt and thus the styling is somewhat different. I wasn't able to find a simple way to make the styling match the other two input widgets, but I'll come back to that in the future.
  • The behavior of the InputInt is (IMO) a bit unintuitive. If the user enters something invalid, the associated value from the widget just stays as whatever it was before. So if I start with an expected class size of 20, then put in, say, "42.7", then the expected_size value is still 20, which will get passed to the database. Also, AFAICT, there's no way to access whether the widget input is in an error state, so I wasn't able to hook a check for that into the button-disable computed.

@Carifio24
Copy link
Member Author

I've also now updated this to allow a teacher to set whether a class will be asynchronous, which was enabled via the API endpoint in cosmicds/cds-api#153.

@nmearl
Copy link
Collaborator

nmearl commented Oct 18, 2024

You could use the base rv.TextField and parse the integer manually. You can see that, under the hood, it's what solara.InputInt does already. That way you can enforce rules yourself and apply custom styling more easily.

@Carifio24
Copy link
Member Author

@nmearl Yeah, that's probably the way to go, particularly for the error state stuff. I'll update that, and then the computed value that allows submitting can be more robust too.

@Carifio24
Copy link
Member Author

@nmearl I did something similar to what you had done with the FigurePlotly in Hubble - I stole the Solara code and tweaked it to add the options that we wanted. The input field now matches visually and allows us to respond in the portal to whether the input is in an error state.

@Carifio24 Carifio24 merged commit 04f34f5 into cosmicds:main Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants